export function getFormattedDate() {
  const now = new Date(); // 创建当前时间的 Date 对象
  const year = now.getFullYear(); // 获取四位年份（如 2023）
  const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始，需 +1 并补零
  const day = String(now.getDate()).padStart(2, '0'); // 获取日期并补零
  return `${year}-${month}-${day}`; // 拼接为 YYYY-MM-DD 格式
}

export function getFormattedDateTime() {
  const now = new Date();
  const year = now.getFullYear();
  const month = String(now.getMonth() + 1).padStart(2, '0');
  const day = String(now.getDate()).padStart(2, '0');
  const hours = String(now.getHours()).padStart(2, '0');
  const minutes = String(now.getMinutes()).padStart(2, '0');
  const seconds = String(now.getSeconds()).padStart(2, '0');
  
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}